package com.hrsoft.modules.expert.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.hrsoft.modules.expert.entity.ExpertGroupConditionEntity;
import com.hrsoft.modules.expert.service.ExpertGroupConditionService;
import com.hrsoft.common.utils.PageUtils;
import com.hrsoft.common.utils.R;



/**
 * 评标专家抽取条件表
 *
 * @author garfield.yue
 * @email yuedefeng101@163.com
 * @date 2020-05-12 14:37:09
 */
@RestController
@RequestMapping("expert/expertgroupcondition")
public class ExpertGroupConditionController {
    @Autowired
    private ExpertGroupConditionService expertGroupConditionService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("expert:expertgroupcondition:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = expertGroupConditionService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("expert:expertgroupcondition:info")
    public R info(@PathVariable("id") Long id){
		ExpertGroupConditionEntity expertGroupCondition = expertGroupConditionService.getById(id);

        return R.ok().put("expertGroupCondition", expertGroupCondition);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("expert:expertgroupcondition:save")
    public R save(@RequestBody ExpertGroupConditionEntity expertGroupCondition){
		expertGroupConditionService.save(expertGroupCondition);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("expert:expertgroupcondition:update")
    public R update(@RequestBody ExpertGroupConditionEntity expertGroupCondition){
		expertGroupConditionService.updateById(expertGroupCondition);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("expert:expertgroupcondition:delete")
    public R delete(@RequestBody Long[] ids){
		expertGroupConditionService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
